<?php
/*
 * Description: 
 * Created on Oct 13, 2008
 * Author: ahoangphuc@yahoo.com 
 */
 date_default_timezone_set('GMT');
 set_include_path(get_include_path().PATH_SEPARATOR.
 'library/'.PATH_SEPARATOR.
 'application/models'.PATH_SEPARATOR);
 
 //load Zend_Loader de load tat ca cac class
 include "Zend/Loader.php";
 Zend_Loader::loadClass('Zend_Auth');
 Zend_Loader::loadClass('Smarty_View');
 Zend_Loader::loadClass('Zend_Config_Ini');
 Zend_Loader::loadClass('Zend_Registry');
 Zend_Loader::loadClass('Zend_Db');
 Zend_Loader::loadClass('Zend_Db_Table');
 Zend_Loader::loadClass('Zend_Controller_Front');
 Zend_Loader::loadClass('Zend_session');
 Zend_Loader::loadClass('Zend_Debug');
 //khoi tao $registry
 $registry = Zend_Registry::getInstance();
 
 //set up configuration
 $config = new Zend_Config_Ini('application/config.ini','general');
 $registry->set('config',$config);
 //set up database
 $db = Zend_Db_Table::factory($config->db->adapter,$config->db->config->toArray());
 $registry->set('db',$db);
 Zend_Db_Table::setDefaulAdapter($db);
 //set up Controller
 $frontController = Zend_Controller::getInstance();
 $frontController->throwException(true);
 $frontController->setControllerDirectory('application/controllers');
 
 //Run
 $frontController->dispatch();
?>
